package com.zhanghu.backendZray.config.mybatis;

import org.apache.ibatis.logging.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author ZhangDong
 * @date 2023/11/21 15:50
 */
public class MybatisLog implements Log {

    private Logger log = LoggerFactory.getLogger(MybatisLog.class);

    public MybatisLog(String clazz) {}

    @Override
    public boolean isDebugEnabled() {
        return true;
    }

    @Override
    public boolean isTraceEnabled() {
        return true;
    }

    @Override
    public void error(String s, Throwable throwable) {
        log.error(s, throwable);
    }

    @Override
    public void error(String s) {
        log.error(s);
    }

    @Override
    public void debug(String s) {
        log.info(s);  // 这里会输出sql执行日志
    }

    @Override
    public void trace(String s) {
        log.trace(s);
    }

    @Override
    public void warn(String s) {
        log.warn(s);
    }
}
